﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Windows.Forms.Design;
using System.ComponentModel;
using System.Drawing;

namespace App
{

    [ToolboxBitmap(typeof(MonthCalendar))]　
    [DefaultProperty("Value")]　　
    [ToolStripItemDesignerAvailability(　
    ToolStripItemDesignerAvailability.ContextMenuStrip　|　
    ToolStripItemDesignerAvailability.MenuStrip　|　
    ToolStripItemDesignerAvailability.StatusStrip　|　
    ToolStripItemDesignerAvailability.ToolStrip)]　
    public class CToolStripDT : ToolStripControlHost
    {
        private System.ComponentModel.IContainer components = null;
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void InitializeComponent()
        {
            components = new System.ComponentModel.Container();

        }
        // Call the base constructor passing in a MonthCalendar instance. 
        public CToolStripDT() : base(new TxtDT()) 
        {
            InitializeComponent();
            Control.Width = 140;
        }

        //public TxtDT TxtDTControl
        //{
        //    get
        //    {
        //        return Control as TxtDT;
        //    }
        //}

        public DateTime Value
        {
            get
            {
                if (Control is TxtDT)
                {
                    return (Control as TxtDT).Value;
                }
                else
                {
                    return DateTime.MinValue;
                }
            }
        }

        public bool ShowCheckBox
        {
            get
            {
                return (Control as TxtDT).ShowCheckBox;
            }
        }

    }

}
